Skip to content

Conversation

voku
Copy link
Contributor

@voku voku commented Sep 6, 2020

Whenever I try to write a regex, it's faster if I don't need the regex at all. So, here's a simple string check before the regex magic.


This change is Reviewable

voku added 4 commits September 7, 2020 00:20
-> try to fix reported errors by phpstan itself
-> try to fix the code style
-> try to fix reported errors by phpstan itself
@ondrejmirtes
Copy link
Member

Hi, this code comes from Composer, so 1) I wouldn't like to differ from the original too much, 2) I'd much rather have the Composer guys do the review :)

The only difference is that the Composer version doesn't support functions because it doesn't make sense in their context (an autoloader) but it does in PHPStan's.

The code in Composer is here: https://github.com/composer/composer/blob/c8731598ccc7d8050dc132b5891f7d15cc7bbc14/src/Composer/Autoload/ClassMapGenerator.php#L216 It's not exactly the same structure but the logic is the same.

Can you please first submit the optimizations to Composer and after they're accepted, do the same ones here? Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants